package com.akk.module.avs.service;

import com.akk.module.avs.entity.DirectSalesBank;
import com.akk.module.avs.entity.DirectSalesBankExample;
import com.akk.module.avs.mapper.DirectSalesBankMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * 直销银行
 */
@Service
public class DirectSalesBankService {

    @Autowired
    private DirectSalesBankExample directSalesBankExample;

    @Autowired
    private DirectSalesBankMapper directSalesBankMapper;

    public List<DirectSalesBank> findByAppIdAndStatus(String appId) {
        directSalesBankExample.clear();
        directSalesBankExample.createCriteria().andAppIdEqualTo(appId).andBankStatusEqualTo("Y");
        return directSalesBankMapper.selectByExample(directSalesBankExample);
    }

    public List<DirectSalesBank> findByAppId(String appId) {
        directSalesBankExample.clear();
        directSalesBankExample.createCriteria().andAppIdEqualTo(appId);
        return directSalesBankMapper.selectByExample(directSalesBankExample);
    }

    public void insert(DirectSalesBank directSalesBank) {
        directSalesBankMapper.insert(directSalesBank);
    }

    public void update(DirectSalesBank directSalesBank) {
        directSalesBankMapper.updateByPrimaryKey(directSalesBank);
    }

    public DirectSalesBank findById(Integer id) {
        return directSalesBankMapper.selectByPrimaryKey(id);
    }

}
